from pydantic import field_validator
from pydantic import BaseModel
class QueryRequest(BaseModel):
    user_identity: str = ""
    user_question: str
    
    @field_validator('user_question')
    def question_must_not_be_empty(cls, v):
        if not v or not v.strip():
            raise ValueError('user_question must not be empty')
        return v
    
    @field_validator('user_identity')
    def identity_must_not_be_too_long(cls, v):
        if len(v) > 100:
            raise ValueError('user_identity must be less than 100 characters')
        return v